package com.shell.provider;

import com.shell.governor.modules.service.PubParameterService;
import com.shell.governor.modules.vo.ParameterVo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PubParameterProvider {
	@Autowired
	private PubParameterService parameterService;

	@RequestMapping(value = { "/parameter/get-parameter" }, method = {
			org.springframework.web.bind.annotation.RequestMethod.GET })
	public ParameterVo getParameter(@RequestParam("bizType") String bizType, @RequestParam String paramCode,
			@RequestParam("parmRlatId") String parmRlatId, @RequestParam("editorId") String editorId) {
		return this.parameterService.getParameter(bizType, paramCode, parmRlatId, editorId);
	}

	@RequestMapping({ "/parameter/update-param" })
	public void updateParam(@RequestBody ParameterVo parameter) {
		this.parameterService.updateParam(parameter);
	}

	@RequestMapping(value = { "/parameter/get-parameter-list" }, method = {
			org.springframework.web.bind.annotation.RequestMethod.GET })
	public List<ParameterVo> getParameterList(@RequestParam("bizCode") String bizCode,
			@RequestParam("parmRlatId") String parmRlatId, @RequestParam("editorId") String editorId) {
		return this.parameterService.getParameterList(bizCode, parmRlatId, editorId);
	}

	@RequestMapping(value = { "/parameter/get-common-parameter" }, method = {
			org.springframework.web.bind.annotation.RequestMethod.GET })
	public ParameterVo getCommonParameter(@RequestParam("paramCode") String paramCode) {
		return this.parameterService.getParameter("0", paramCode, "0", null);
	}
}
